package com.sitanyun.merchant.guide.frament.model.impl;

import com.google.gson.Gson;
import com.sitanyun.merchant.guide.bean.MyUserInfoBean;
import com.sitanyun.merchant.guide.callback.StringCallbacks;
import com.sitanyun.merchant.guide.frament.model.inter.IMyusersFramentFModel;
import com.sitanyun.merchant.guide.frament.presenter.callback.CallBack;
import com.sitanyun.merchant.guide.url.Urls;
import com.sitanyun.merchant.guide.weiht.SharedPreferenceUtil;
import com.zhy.http.okhttp.OkHttpUtils;

import okhttp3.Call;

/**
 * 我的界面
 */
public class MyusersFramentFModelImpl implements IMyusersFramentFModel {
    @Override
    public <T> void setuser(CallBack callBack) {
        OkHttpUtils.get().url(Urls.myinfo)
                .addHeader("Authorization","Bearer"+ SharedPreferenceUtil.getStringData("token"))
                .build().execute(new StringCallbacks() {
            @Override
            public void onError(Call call, Exception e, int id) {

            }

            @Override
            public void onResponse(String response, int id) {
                MyUserInfoBean baseEntity=  new Gson().fromJson(response, MyUserInfoBean.class);
                callBack.onSuccess(baseEntity);
            }
        });
    }
}
